<?php
$page_name=basename($_SERVER['SCRIPT_FILENAME']);
$IsPreserved	= 'Y';
$IsProcess		= $_REQUEST['IsProcess'];
include("general_include.php");
include "checklogin.php";
if($IsProcess <> 'Y')
{
	include "top.php";
	include "left.php";
}	

$action	= $_REQUEST['action'];

if($action=="del")
{	
	if(!empty($delete_id))
	{
	
	  $DelSql = "DELETE FROM ".TABLEPREFIX."_user_game where user_game_id='$delete_id'";
	  $UserManagerObjAjax->Execute($DelSql);
	  
    }	  	 
}  
function findvalue($table,$fld_name,$fld_value,$find_value)
{
     if($fld_value=='')
			return false;
			
		$SelectTypeSql = "SELECT ".$find_value." FROM ".$table." WHERE $fld_name=".$fld_value;
		$SelectType = mysql_fetch_array(mysql_query($SelectTypeSql));
		return $SelectType[0];
}	


$StudentgameSql = "SELECT * FROM ".TABLEPREFIX."_user_game where user_id='".$_SESSION['user_id']."' ORDER BY date_added DESC";
$StudentgameArr = $UserManagerObjAjax->GetRecords("All",$StudentgameSql);
$Numstudentgame=count($StudentgameArr);

for($g=0;$g<$Numstudentgame;$g++)
{
    $StudentgameArr[$g]['game']= findvalue(TABLEPREFIX."_game","game_id",$StudentgameArr[$g]['game_id'],"game_name");
	$StudentgameArr[$g]['experience']= stripslashes($StudentgameArr[$g]['experience']);
}

$smarty->assign('Numstudentgame',$Numstudentgame);
$smarty->assign('StudentgameArr',$StudentgameArr);
$smarty->assign('page_name',$page_name);
$smarty->display('student_game.tpl');
if($IsProcess<>'Y')
   include "footer.php";
?>